import 'package:flutter/cupertino.dart';
import 'package:hitutor/Util/Global.dart';
import 'package:hitutor/Util/MyColor.dart';
import 'package:hitutor/Util/PageUtil.dart';
import 'package:hitutor/Widget/MyButton.dart';
import 'package:hitutor/Widget/MyPage.dart';

class DistributingSuccess extends StatefulWidget {
  dynamic oldLessonName;
  int oldLessonCount;
  dynamic newLessonName;
  int newLessonCount;

  DistributingSuccess(
      {required this.oldLessonName, required this.oldLessonCount, required this.newLessonName, required this.newLessonCount});

  @override
  State<StatefulWidget> createState() {
    return _DistributingSuccess();
  }
}

class _DistributingSuccess extends State<DistributingSuccess> {
  @override
  Widget build(BuildContext context) {
    int surplus = widget.oldLessonCount - widget.newLessonCount;

    return MyPage(
        "配課成功",
        Container(
          child: Column(children: [
            Container(
                padding: EdgeInsets.all(32),
                child: Column(crossAxisAlignment: CrossAxisAlignment.end, children: [
                  Text("${widget.oldLessonName} ${widget.oldLessonCount}堂", style: TextStyle(height: 2, color: MyColor.C7D)),
                  Row(mainAxisSize: MainAxisSize.min, children: [
                    Container(height: 2, width: 10, decoration: Global.getBg(MyColor.C7D, 1), margin: EdgeInsets.only(right: 24)),
                    Text("${widget.newLessonName} ${widget.newLessonCount}堂", style: TextStyle(height: 2, color: MyColor.C7D))
                  ]),
                  Container(height: 0.5, color: MyColor.C7D, margin: EdgeInsets.fromLTRB(0, 8, 0, 8)),
                  Row(mainAxisSize: MainAxisSize.min, children: [
                    Text("${widget.oldLessonName}", style: TextStyle(color: MyColor.C7D)),
                    Container(width: 16),
                    Text("$surplus堂", style: TextStyle(color: MyColor.Red, fontWeight: FontWeight.bold))
                  ])
                ])),
            Expanded(child: Container()),
            Container(height: 1, color: Color(0xffdee2e6)),
            TextBtn("確認", height: 36, width: 120, margin: EdgeInsets.fromLTRB(0, 8, 0, 8), style: TextStyle(color: MyColor.Orange),
                onTap: () {
              PageUtil().back(context);
            })
          ]),
        ));
  }
}
